-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using multiple map interactions #751
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #751 +/- ##
===========================================
- Coverage 81.10% 58.86% -22.25%
===========================================
Files 235 230 -5
Lines 4859 4252 -607
Branches 1324 771 -553
===========================================
- Hits 3941 2503 -1438
- Misses 888 1524 +636
- Partials 30 225 +195 ☔ View full report in Codecov by Sentry. |
Because this feature will be added after 3.0, this PR is moved to draft. This PR is still ready to be reviewed, it just shouldn't be merged just yet |
95cf149
to
2690059
Compare
Added leaflet-draw and react-leaflet-draw as dependencies. These allow easy user interactions with the leaflet map
…ead of coordinates The map component now uses and stores geoJson data, instead of coordinates. This means we can display and work with multiple shapes. One important change is that geoJson saves coordinates as lng-lat, instead of lat-lng
2690059
to
56151ac
Compare
…ponent property With the new property `interactions` the component can defined the possible map interactions. Currently supporting 'marker', 'polygon' and 'polyline'
4b84451
to
2c8cf65
Compare
…tories for map component
2c8cf65
to
5598809
Compare
Due to some formio magic, the `resetValue` flag is needed when performing the `setValue` call. Without this flag it isn't allowed to set a field value to `null` or `undefined`.We also need to use the value `null`, instead of `undefined`. This because setting the value to `undefined` isn't reflected as a value change (what we need, to re-render the component). This is described in node_modules/formiojs/components/_classes/component/Component.js:2524
Part of open-formulieren/open-forms#2177
This allows users to interact with the map using multiple tools: markers (the interaction that is already being used), polygons and polylines. With the aim to give users more accurately control. Using the new
interactions
property every tool can be included or excluded separately. By default, only the marker will be available to users (conform the current functionality)The different tools result in different data. To accommodate this the data of the component has been changed from an array of numbers, to a geoJson object.
All previously existing functionality has been updated to work with this new data format. This includes:
To accommodate the polyline and polygon, the center point of a shape is used as the centering point. This changes nothing for the marker shapes
This currently also works for the polyline and polygon. Because these shapes consist of multiple points/coordinates, the center point of these shapes is used as the
search nearby address
coordinates